package com.mjlf.compute;

import gnu.io.CommPortIdentifier;

import java.util.Enumeration;

/**
 * @ClassName Test
 * @auther mjlf
 * @Date 2019/7/8 13:51
 * @Description TODO
 */
public class Test {

    public static void main(String[] args) {
        System.out.println("program started");
        CommPortIdentifier serialPortId;

        Enumeration enumComm = CommPortIdentifier.getPortIdentifiers();
        while(enumComm.hasMoreElements()){
            serialPortId = (CommPortIdentifier) enumComm.nextElement();
            if(serialPortId.getPortType() == CommPortIdentifier.PORT_SERIAL){
                System.out.println(serialPortId.getName());
            }
        }
        System.out.println("Finished successfully");

    }
}
